package tech.heptagram.staff.api.v3;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import tech.heptagram.core.common.rest.ResponseResult;
import tech.heptagram.staff.model.BpmsProcess;
import tech.heptagram.staff.service.BpmsProcessService;

/**
 * @author wang.yuchuan
 * @createdAt 2019/3/22
 */
@Api("审批流相关api")
@RestController
@RequestMapping("/api/v3/bpms")
@Slf4j
public class BpmpProcessApiRestController implements BpmsProcessApi {

    @Resource
    private BpmsProcessService bpmsProcessService;

    @ApiOperation("根据id获取审批流信息")
    @GetMapping("/get/{id}")
    @Override
    public ResponseResult<BpmsProcess> findById(@PathVariable Integer id) {

        log.info("根据id获取审批流信息 findById 开始 接受参数:id {} ", id);
        BpmsProcess bpmsProcess = bpmsProcessService.findById(id);
        log.info("根据id获取审批流信息 findById 结束 result: {} ", bpmsProcess);
        return new ResponseResult<>(bpmsProcess);
    }
}
